//
//  CarFenceCell.m
//  carcareIOS
//
//  Created by ileo on 15/7/21.
//  Copyright (c) 2015年 baozun. All rights reserved.
//

#import "CarFenceCell.h"

#define CELLHEIGHT 60

@interface CarFenceCell()

@property (nonatomic, strong) UILabel *nameL;
@property (nonatomic, strong) UILabel *addrL;
@property (nonatomic, strong) UILabel *radiusL;

@end

@implementation CarFenceCell

+(CGFloat)cellHeight{
    return CELLHEIGHT;
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        CGFloat gap = 20;
        self.nameL = [Factory labelWithFrame:CGRectMake(gap, 5, __MAIN_WIDTH - 4*gap, 25) font:FONT_DEFAULT_Light(15) text:nil textColor:[Theme wordColor] onView:self textAlignment:NSTextAlignmentLeft];
        self.addrL = [Factory labelWithFrame:CGRectMake(gap, self.nameL.bottom, __MAIN_WIDTH - 4*gap, 20) font:FONT_DEFAULT_Light(13) text:nil textColor:[Theme wordGrayColor] onView:self textAlignment:NSTextAlignmentLeft];
        UIImageView *iV = [Factory imageViewWithCenter:CGPointMake(__MAIN_WIDTH - 25, CELLHEIGHT/2) image:ImageNamed(@"cell_right") onView:self];
        [Factory viewWithFrame:CGRectMake(0, CELLHEIGHT, __MAIN_WIDTH, 0.5) bgColor:[Theme lineColor] onView:self];
        self.radiusL = [Factory labelWithFrame:CGRectMake(0, 0, 100, 20) font:FONT_DEFAULT_Light(13) text:nil textColor:[Theme wordGrayColor] onView:self textAlignment:NSTextAlignmentRight];
        self.radiusL.centerY = CELLHEIGHT / 2;
        self.radiusL.right = iV.left;
    }
    return self;
}

-(void)setModel:(CarFenceModel *)model{
    self.nameL.text = model.name;
    self.addrL.text = model.address;
    self.radiusL.text = [NSString stringWithFormat:@"%zd米",model.radius];
}

@end
